var express = require('express');
const Menu = require('../services/web_menu_serve');
var web_login_test = require('./web_login_test');
var router = express.Router();


//当前网点
router.get('/net', web_login_test.ensureAuthenticated, function (req, res, next) {

	Menu.findNet(function (err, row) {
		if (err) {
			return next(err);
		}
		res.render('web_net', {
			title: '当前网点信息',
			arr: [{ sch: '', lib: 'active', abt: '', log: '' }],
			net: row,
			username:req.url.username
		});
	});
});


//历史订单信息
router.get('/order', web_login_test.ensureAuthenticated, function (req, res) {
	Menu.findOverOrder(function (err, row) {
		if (err) {
			return next(err);
		}

		res.render('web_order', {
			title: '历史订单信息',
			arr: [{ sch: '', lib: 'active', abt: '', log: '' }],
			overorder: row
		});
	})
});


//uav信息
router.get('/uav', web_login_test.ensureAuthenticated, function (req, res, next) {
	Menu.findUav(function (err, row) {
		if (err) {
			return next(err);
		}

		res.render('web_uav', {
			title: 'uav信息',
			arr: [{ sch: '', lib: 'active', abt: '', log: '' }],
			uav: row
		});
	});
});

//员工信息
router.get('/emplo', web_login_test.ensureAuthenticated, function (req, res) {
	Menu.findEmplo(function (err, row) {
		if (err) {
			return next(err);
		}
		res.render('web_emplo', {
			title: '员工信息',
			arr: [{ sch: '', lib: 'active', abt: '', log: '' }],
			emplo: row
		});
	});
});



module.exports = router